package com.dys.designpattern.simplefactory.applycar.factory;

import com.dys.designpattern.simplefactory.applycar.service.ICar;
import com.dys.designpattern.simplefactory.applycar.service.impl.Byd;
import com.dys.designpattern.simplefactory.applycar.service.impl.Tasla;
import com.dys.designpattern.simplefactory.applycar.service.impl.Wuling;

/**
 * @Author: 疾风
 * @ClassName: CarFactory
 * @Description: 具体工厂：创建对应的汽车
 * @CreateDate: 2024/05/14
 * @Version: v1.0.0
 */
public class CarFactory {

    public static ICar getCar(String name) {
        ICar car = null;
        if (name == "五菱") {
            car = new Wuling();
        } else if (name == "特斯拉") {
            car = new Tasla();
        } else {
            car = new Byd();
        }
        return car;
    }
}
